/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package nueva.esperanza.svc.impl;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import nueva.esperanza.dao.BancoSvc;
import nueva.esperanza.dao.ChequeraSvc;
import nueva.esperanza.exception.BDError;
import nueva.esperanza.exception.DaoException;
import nueva.esperanza.modelo.Banco;
import nueva.esperanza.modelo.Chequera;
import nueva.esperanza.svc.FacadeSvc;
import org.apache.log4j.Logger;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author mgcharuc
 */
public class FacadeImpl implements FacadeSvc, Serializable {
    
    private static Logger log = Logger.getLogger(FacadeImpl.class);
    
    //Servicios
    private ChequeraSvc chequeraSvc;
    private BancoSvc bancoSvc;
    
    public List<Chequera> findChequeraAll() throws BDError {
        List<Chequera> chequeras = new ArrayList<Chequera>();
        try {
            chequeras = getChequeraSvc().findAll();
        } catch(DaoException ex) {
            throw new BDError(ex.getMessage());
        }
        return chequeras;
    }
    
    public void guardarBanco(Banco objBanco) throws BDError{
        try {
            bancoSvc.guardar(objBanco);
        } catch(BDError ex) {
            log.error(ex.getMessage());
            //error(ex.getMessage());
        }
    }

    /**
     * @return the chequeraSvc
     */
    public ChequeraSvc getChequeraSvc() {
        return chequeraSvc;
    }

    /**
     * @param chequeraSvc the chequeraSvc to set
     */
    public void setChequeraSvc(ChequeraSvc chequeraSvc) {
        this.chequeraSvc = chequeraSvc;
    }

    /**
     * @return the bancoSvc
     */
    public BancoSvc getBancoSvc() {
        return bancoSvc;
    }

    /**
     * @param bancoSvc the bancoSvc to set
     */
    public void setBancoSvc(BancoSvc bancoSvc) {
        this.bancoSvc = bancoSvc;
    }
    
}
